package com.aruba.bulethoothdemoapplication.utils.printer;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by xuqiwei on 19-11-21.
 * 打印相关的类
 */
public class PrintStuff implements Parcelable {
    private PrintType printType;
    private String data;

    public enum PrintType {
        TextType,ImagePathType, ImageBase64Type, ChangeSize, ResetSize
    }

    public PrintType getPrintType() {
        return printType;
    }

    public void setPrintType(PrintType printType) {
        this.printType = printType;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.printType == null ? -1 : this.printType.ordinal());
        dest.writeString(this.data);
    }

    public PrintStuff(PrintType printType, String data) {
        this.printType = printType;
        this.data = data;
    }


    public PrintStuff(PrintType printType) {
        this.printType = printType;
    }
    
    protected PrintStuff(Parcel in) {
        int tmpPrintType = in.readInt();
        this.printType = tmpPrintType == -1 ? null : PrintType.values()[tmpPrintType];
        this.data = in.readString();
    }

    public static final Creator<PrintStuff> CREATOR = new Creator<PrintStuff>() {
        @Override
        public PrintStuff createFromParcel(Parcel source) {
            return new PrintStuff(source);
        }

        @Override
        public PrintStuff[] newArray(int size) {
            return new PrintStuff[size];
        }
    };
}
